from django.db import models
from django.contrib.auth.models import AbstractUser

# Create your models here.
class UserInfo(AbstractUser):
    # name = models.CharField(max_length=20)
    # password = models.CharField(max_length=20)
    # phone = models.IntegerField()
    # gender = models.CharField()
    # active = models.IntegerField(default=0)
    is_delete = models.IntegerField(default=0)
    # user_phone = models.IntegerField(null=False)
    # res_time = models.IntegerField()
    # update_time = models.IntegerField()
    # def __str__(self):
    #     return self.username
    class Meta:#(元类：对类进行修改)
        db_table  = 'userinfo'
        verbose_name = '用户信息'
        verbose_name_plural =verbose_name


class UserAddress(models.Model):
    user = models.ForeignKey('UserInfo',null=False,verbose_name='所属的用户')
    recv = models.CharField(max_length=10,null=False,verbose_name='收货人')
    recv_phone = models.IntegerField(null=False,verbose_name='收件人联系方式')
    service_phone = models.IntegerField(null=False,verbose_name='客服')
    address = models.CharField(max_length=30,null=False,verbose_name='收货人地址')
    is_delete = models.IntegerField(default=0)

    def __str__(self):
        return self.address
    class Meta:
        verbose_name = '收件地址'
        verbose_name_plural = verbose_name